import React from 'react'
import {Link} from 'react-router'
import Action from '../../../action/action'
import Store from '../../../store/store'
import ReactMixin from 'react-mixin'
import Reflux from 'reflux'

import SideNavBar from '../../../component/sideNavBar/sideNavBar'

export default class MyBankCard extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            userWallet : {}
        }
    }
    componentDidMount(){
        Action.getUserWallet(()=>{})
    }
    render(){
        let userWallet = this.state.userWallet,
            list = [];
        userWallet.cardList && userWallet.cardList.map((obj,i)=>{
            list.push(
                <li key={i}>
                    <div>
                        <h4>
                            <img src={obj.bankLogo} alt=""/>
                            <span>
                                <p>{obj.bankName}</p>
                                <span>存储卡</span>
                            </span>
                        </h4>
                        <a>
                            <i className="iconfont icon-guanbi"></i>
                        </a>
                    </div>
                    <p>{obj.bankNum}</p>
                </li>
            )
        })
        return(
            <div className="myBankCard">
                <ul>
                    {list}
                </ul>
                <Link className="bankCardAddBtn" to="/my/bankAdd">
                    <i className="iconfont icon-tianjia"></i>
                    <span>添加银行卡</span>
                </Link>
                <SideNavBar/>
            </div>
        )
    }
}
ReactMixin.onClass(MyBankCard,Reflux.connect(Store))